package com.tenbent.product.center.role.dto;

import com.tenbent.product.base.dto.BaseDto;
import com.tenbent.product.center.role.bo.Role;
import org.hibernate.validator.constraints.NotEmpty;

/**
 * 角色DTO基类
 *
 * @author Randy
 *
 *         Created by ThinkPad on 2017/9/1.
 */
public class RoleDto extends BaseDto {

	/** 角色名称 */
	@NotEmpty(message = "{role.name.not.empty}")
	private String roleName;

	/** 角色编码 */
	@NotEmpty(message = "{role.code.not.empty}")
	private String roleCode;

	/** 角色描述 */
	@NotEmpty(message = "{role.desc.not.empty}")
	private String roleDesc;

	public RoleDto() {

	}

	public RoleDto(Role role) {
		super(role);
		setRoleName(role.getRoleName());
		setRoleCode(role.getRoleCode());
		setRoleDesc(role.getRoleDesc());
	}

	public Role transToBo() {
		Role role = new Role();
		super.transToBo(role);
		role.setRoleCode(this.getRoleCode());
		role.setRoleName(this.getRoleName());
		role.setRoleDesc(this.getRoleDesc());
		return role;
	}

	public String getRoleName() {
		return roleName;
	}

	public void setRoleName(String roleName) {
		this.roleName = roleName;
	}

	public String getRoleCode() {
		return roleCode;
	}

	public void setRoleCode(String roleCode) {
		this.roleCode = roleCode;
	}

	public String getRoleDesc() {
		return roleDesc;
	}

	public void setRoleDesc(String roleDesc) {
		this.roleDesc = roleDesc;
	}
}
